//
//  NSObject+HDChatReplyModel.m
//  app
//
//  Created by D on 15/6/11.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HDChatReplyModel.h"

@implementation HDChatReplyModel

-(instancetype)initWithDic:(NSDictionary *)dict
{
    if (self = [super init]) {
        
        CGFloat rightWight = SCREEN_WIDTH - UF(24)*4-UF(88)*2;
        
        self.msgid = dict[@"msgid"];
        self.title = dict[@"title"];
        self.uid = dict[@"uid"];
        self.forum = dict[@"forum"];
        self.card = dict[@"card"];
        self.content = dict[@"content"];
        self.face = dict[@"face"];
        self.name = dict[@"name"];
        self.time = dict[@"time"];
        
        CGFloat width = [self.content boundingRectWithSize:CGSizeMake(100000, 20) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size.width;
        
        if (width > rightWight) {
            self.textWight = rightWight;
            self.textHeight = [XCommon heightForString:self.content fontSize:14 andWidth:rightWight];
        }else
        {
            self.textWight = [XCommon widthForString:self.content fontSize:14];
            self.textHeight = [XCommon heightForString:self.content fontSize:14 andWidth:self.textWight];
        }

        
    }
    return self;
}

+(instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDic:dict];
}
@end
